package com.qf.utils;

import java.util.Random;

public class CodeUtils {

    public static final String[] CODE_ARR = {"0","1","2","3","4","5","6","7","8","9"};

    public static String createCode(int length){

        Random random = new Random();
        StringBuffer stringBuffer = new StringBuffer();
        for (int i=0;i<length;i++) {
            int index = random.nextInt(CODE_ARR.length);
            String s = CODE_ARR[index];
            stringBuffer.append(s);
        }
        return stringBuffer.toString();
    }

    public static void main(String[] args) {
        for (int i=0;i<5;i++) {
            System.out.println(createCode(6));
        }
    }

}
